<table class="table" id="somainDiv">
    <thead>
    <tr>
        <th>序号</th>
        <th>产品编号</th>
        <th>产品名称</th>
        <th>库存数量</th>
        <th>采购在途数</th>
        <th>销售在途数</th>
        <th colspan="2">操作</th>
    </tr>
    </thead>
    <tbody id="tableBody"></tbody>
</table>

<script id="checkStockTemplate" type="text/html">
    {{each data value index}}
    <tr>
        <td>{{index+1}}</td>
        <td>{{value.productCode}}</td>
        <td>{{value.name}}</td>
        <td>{{value.num}}</td>
        <td>{{value.poNum}}</td>
        <td>{{value.soNum}}</td>
        <td><input type="button" value="盘点" onclick="checkStock('{{value.productCode}}')"></td>
        <td><input type="button" value="查看盘点记录" onclick="checkStockRecord('{{value.productCode}}')"></td>
    </tr>
    {{/each}}
</script>
<script>
    $(function () {
        showPage({
            currentPage: 1,
            pageSize: 2,
            url: '/getAllProductForStore',
            templateId: 'checkStockTemplate',
            contentId: 'tableBody',
            params: {
                id: 1
            }
        })
    })
    function checkStock(obj) {
        window.sessionStorage.setItem("storeProductCode",obj)
        show("/store/checkStockItem.html")
    }
    function checkStockRecord(obj) {
        window.sessionStorage.setItem("storeProductCode",obj)
        show("/store/inCheckStock.html")
    }
</script>